using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SQLite;
using System.Windows.Forms;

/***********************************************************************************
 * File Name: SetCache.cs
 * 
 * File Description:
 *  This file handles all of the database connectivity to edit cache status, and 
 *  to update the cache itself.
 * ********************************************************************************/

namespace Cache
{
    class SetCache
    {
        public void SetCacheFound(string CacheName)
        {
            SQLiteConnection conn = new SQLiteConnection("data source=" + Application.StartupPath + @"\GeoCaches.db");

            conn.Open();

            string SQL = null;

            SQL = "UPDATE tblGeoCache SET Status = 'Found' WHERE Name ='" + CacheName + "'";

            SQLiteCommand cmd = new SQLiteCommand(SQL, conn);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString() + "\r\n\r\nSQL Statement: " + SQL);
            }

            conn.Close();
        }
    }
}
